All Questions
374 questions
0votes
1answer
57views
Send / Receive javascript FileList to rails 7 controller (Drag and Drop mode)
I have a form. <form id="add_content" enctype="multipart/form-data" action="/contents/create" accept-charset="UTF-8" method="post"><input ...
0votes
1answer
592views
Can't see full breakdown of multipart/form-data response in Chrome
This question all stemmed from trying to understand why I am not able to get the proper file MimeType in rails. Each file I've sent, csv, pdf, etc... returns type application/octet-stream. So, I was ...
0votes
1answer
323views
Refactoring form fields and Stimulus JS so to not repeat :data-action once for each form field
I've the following form <%= form_for( model, html: { :'data-controller' => 'enable-submit-button-if-fields-changed' } ) do |form| %> <%= form.text_field(:title, :'...
0votes
0answers
576views
rails - Update View when Form is Submitted without Refreshing the Page
I'm building a Rails app in which there are exercises and user_answers. When the user sees an exercise, there is a form that he can submit with the answer he thinks is right. When submitting, I want ...
0votes
2answers
47views
Hide blocks in form when choosing options
I had a form for announcements. I need to hide some divs when user choose something. For example, when user choose 'Buy', i need to hide div with :services. User must to see only divs for 'Buy'. If ...
0votes
1answer
117views
Can you refresh a nested object with JS so the attributes that depend on parent attributes are reloaded as well?
I have a Plan model which has_many Versions. I'm nesting a Version form inside a Plan form. form <%= simple_form_for @plan do |f| %> <%= f.simple_fields_for :version do |v| %> <%= ...
2votes
2answers
941views
How to add Label inside correct "form group" in Ruby on Rails form?
I'm using Rails 5.2 and have this simple rails form and a field for the IP address that looks like this: <%= bootstrap_form_for(@asset, :url => asset_path(@asset.id), ...
0votes
2answers
138views
How to have JS onpaste event work with Rails form?
I have a search form, and would like it so that when I paste something into the form, it automatically submits the form. I would also like to retain functionality so if I don't paste something, and ...
0votes
1answer
36views
Getting rails DB data passed to JS for dynamically creating new select menus
I'm attempting to create a Twitter-like webpage for practice. I have a form for submitting a new "tweet" that allows for a user to optionally add a mention of another user. In this, there is ...
1vote
1answer
684views
Ruby on Rails Form Add an "Other" Option with Text Box to Select Dropdown
I have a ruby form that includes the following code <%= form.label(:emitter_type, class: "form-label") %> <%= form.select(:emitter_type, BoilerPlant.emitter_type , ...
0votes
1answer
392views
A dynamic dropdown (selectbox) menu in Rails with jQuery is not reversible
On a website form controlled by Rails 6.1, I want to implement a "dynamic" or cascade dropdown menu so that the choices in the second dropdown varies depending on the selected item in the ...
1vote
0answers
2kviews
How to check that all target values have changed in StimulusJS?
I have an index page where I have to filter Invoices by due_date to prepare them for mass edition. The idea is to keep the submit button disabled until a start_date and end_date have been selected. I ...
1vote
1answer
767views
JavaScript form fetch request submitting empty values when they are filled in
I am creating a Login form in JavaScript and am trying to send this form to my Ruby on Rails backend. I have two problems: When the form loads, it triggers the eventListener and sends the blank form'...
1vote
1answer
3kviews
Unable to make flatpickr field required in rails form
I have a form_for form. Some of my fields are for selecting dates, which I'm using flatpickr for. I'm having trouble making the field required using form validation on the client side. I have the ...
0votes
0answers
166views
Adding a dynamic field via javascript on RoR
I would like to add dynamically fields to a form in a ERB file and I'm getting an issue that I don't know how to fix. Basically, a user clicks a btn on a form and a new input text field is added via ...